package mytest.lxpFunnyTest.utils;

import lombok.Data;
import mytest.lxpFunnyTest.domain.vo.MyKeyValue;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

@Data
public class KeyBoardUtil {
    private static List<MyKeyValue> list=new ArrayList<>();
    static {
        list.add(new MyKeyValue("ctrl",0x11));
        list.add(new MyKeyValue("shift",0x10));
        list.add(new MyKeyValue("alt",0x12));
        list.add(new MyKeyValue("enter",'\n'));
        list.add(new MyKeyValue("r",0x52));
    }

    public static int find(String s){
        for (MyKeyValue myKeyValue : list) {
            if (Objects.equals(s,myKeyValue.getMyKeyName())){//操作对应
                return myKeyValue.getMyKeyCode();//返回键盘操作码
            }
        }
        return -1;
    }



}
